import React, { useState } from 'react';
//计数器
export default function A() {
  const [num, setNum] = useState(0);
  return (
    <>
      <div className='box'>
        <span>{num}</span>
        <br />
        <button
          onClick={() => {
            setNum(num + 1);
          }}
        >
          增加
        </button>
        <button
          onClick={() => {
            setNum(num - 1);
          }}
        >
          减少
        </button>
      </div>
    </>
  );
}
